package com.fy.core.exception;

import com.fy.core.vo.ApiRest;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ExceptionResolver {

    @ExceptionHandler(ServiceException.class)
    public ApiRest handler(ServiceException exception){
        return ApiRest.failure(exception.getMsg(), "");
    }

}
